using System;
using System.Net;

namespace RestSharpEx
{
    public class RestRequestAsyncHandle
    {
        public HttpWebRequest WebRequest;
        public Action<RestRequestAsyncHandle,WebRequest> progress_action = null;
        public long HasSentDataLen = 0;

        public RestRequestAsyncHandle() { }

        public RestRequestAsyncHandle(HttpWebRequest webRequest)
        {
            this.WebRequest = webRequest;
        }

        public void Abort()
        {
            if (this.WebRequest != null)
            {
                this.WebRequest.Abort();
            }
        }

        public void NotifyUploadMonitor(WebRequest usedRequest)
        {
            if (progress_action == null)
                return;

            progress_action(this, usedRequest);
        }
    }
}
